aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/[username]/receive/+page.server.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/routes/[username]/receive/+page.server.js')
-rw-r--r--src/routes/[username]/receive/+page.server.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/routes/[username]/receive/+page.server.js b/src/routes/[username]/receive/+page.server.js
new file mode 100644
index 00000000..8d523213
--- /dev/null
+++ b/src/routes/[username]/receive/+page.server.js
@@ -0,0 +1,12 @@
+import { auth, post } from '$lib/utils';
+
+export const actions = {
+ default: async ({ cookies, request, parent }) => {
+ let { rate, user } = await parent();
+ let invoice = Object.fromEntries(await request.formData());
+ invoice.rate = rate;
+
+ let { uuid } = await post('/invoice', { invoice, user }, auth(cookies));
+ throw redirect(303, `/invoice/${uuid}`);
+ }
+};